﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace DIST.LR.ZHJG.Controls.Chart
{
    public partial class ucVFLinearGauge : UserControl
    {
        public ucVFLinearGauge()
        {
            ViewModelLG vmlg = new ViewModelLG(70, 0, 90, 60, 0, 100);
            InitializeComponent();
            this.VFLinearGauge.Loaded += new RoutedEventHandler(VFLinearGauge_Loaded);
            VFLinearGauge.DataContext = vmlg;
            
        }

        void VFLinearGauge_Loaded(object sender, RoutedEventArgs e)
        {
            var c = sender as Visifire.Gauges.Gauge;
            IEnumerable<TextBlock> lablels = VisualTreeAPI.FindVisualChildren<TextBlock>(c.Parent as System.Windows.Controls.Grid);
            foreach (TextBlock txt in lablels)
            {
                if (txt.Text.ToLower().Contains("trial"))
                {
                    txt.Visibility = System.Windows.Visibility.Collapsed;
                    if (txt.Parent is Border)
                    {
                        (txt.Parent as Border).Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
                    }
                }
            }
        }
    }

    public class ViewModelLG
    {
        private double _value1;
        private double _minimum1;
        private double _maxmum1;
        private double _value2;
        private double _minimum2;
        private double _maxmum2;
 
        public double Value1
        {
            get { return _value1; }
            set { _value1 = value; }
        }

        public double Minimum1
        {
            get { return _minimum1; }
            set { _minimum1 = value; }
        }

        public double Maxmum1
        {
            get { return _maxmum1; }
            set { _maxmum1 = value; }
        }

        public double Value2
        {
            get { return _value2; }
            set { _value2 = value; }
        }

        public double Minimum2
        {
            get { return _minimum2; }
            set { _minimum2 = value; }
        }

        public double Maxmum2
        {
            get { return _maxmum2; }
            set { _maxmum2 = value; }
        }

        public ViewModelLG(double value1, double minimum1, double maxmum1, double value2, double minimum2, double maxmum2)
        {
            this._value1 = value1;
            this._minimum1 = minimum1;
            this._maxmum1 = maxmum1;
            this._value2 = value2;
            this._minimum2 = minimum2;
            this._maxmum2 = maxmum2;
        }

    }
}
